<template>
	<!-- loading 加载 -->
	<view class="box" v-if="isShow">
		<view class="mix-loading-content">
			<view class="mix-loading-wrapper">
				<view class="">
					<image class="mix-loading-icon" src="../../static/login/logo.png"></image>
				</view>
				<view class="title">{{title}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'mix-loading',
		props: {
			top: {
				//距离顶部距离，单位upx
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				isShow: false,
				title: ""
			};
		},
		methods: {
			open(str) {
				if (str) {
					this.title = str
				} else {
					this.title = "加载中..."
				}
				// this.title = str;
				this.isShow = true
			},
			close() {
				this.isShow = false
			}
		}
	}
</script>

<style scoped>
	.box {
		background-color: rgba(0, 0, 0, .5);
		width: 100vw;
		height: 100vh;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 9999999;
	}

	.mix-loading-content {
		display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		/* width: 100%; */
		/* height: 100%; */
		background-color: transparent;
	}

	.mix-loading-wrapper {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		animation: loading .5s ease-in infinite both alternate;
		background-color: #393939;
		min-width: 200upx;
		min-height: 100upx;
		color: #FFFFFF;
		padding: 20upx 20upx;
		border-radius: 10upx;
		font-size: 26upx;
	}

	.mix-loading-icon {
		width: 80upx;
		height: 80upx;
		transition: .3s;
	}
</style>
